# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=kmidimon
pkgver=1.3.1
pkgrel=3
pkgdesc="A MIDI monitor for Linux using ALSA sequencer"
arch=(loong64 x86_64)
url="https://kmidimon.sourceforge.io/"
license=(GPL2)
groups=(pro-audio)
depends=(gcc-libs glibc qt6-5compat qt6-base)
makedepends=(alsa-lib cmake drumstick pandoc qt6-tools)
source=($pkgname-$pkgver.tar.gz::https://github.com/pedrolcl/$pkgname/archive/refs/tags/RELEASE_$pkgver.tar.gz)
sha512sums=('dfe120767c88bc59edd61526a43d2d686a08245470f8bb6e31297206fee63ef18c7365ad86b06716ea18237fbd501536e7ab42bab2348523b9b897b3c07431e8')
b2sums=('42d9f8eb2fc6ff86a5382cf7405d577962d40511c09fbe0e7a9a4fbcceff27ed93707dbfdb22a06ca237b078aaf003d40eb6896a3d3531921adfff1d29da29d5')

build() {
  local cmake_options=(
    -B build
    -S $pkgname-RELEASE_$pkgver
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX=/usr
    -Wno-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  depends+=(
    drumstick libdrumstick-alsa.so libdrumstick-file.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-RELEASE_$pkgver/{AUTHORS,ChangeLog,{INSTALL,NEWS,README,TODO}.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
